﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SocialIn.Biz;
using System.Data;

namespace SocialIn.Web.MyPage
{
    public partial class Iam : System.Web.UI.Page
    {
        Join _join;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (HttpContext.Current.Session[ConfigName.SessionMember] == null)
            {
                Response.Redirect("/Members/Login.aspx");
                return;
            }

            Initialize();

        }

        private void Initialize()
        {
            string userid = (HttpContext.Current.Session[ConfigName.SessionMember] as Member).UserID;
            _join = new Join();

            rptMyGiveList.DataSource = _join.GetMyGiveList(userid);
            rptMyGiveList.DataBind();

            rptMyGiveHistory.DataSource = _join.GetMyGiveHistory(userid);
            rptMyGiveHistory.DataBind();
        }

        protected void rptMyGiveList_DataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.AlternatingItem ||
                    e.Item.ItemType == ListItemType.Item)
            {
                DataRow row = ((DataRowView)e.Item.DataItem).Row;
                Panel pal = e.Item.FindControl("delPalnel") as Panel;

                if (row["IsCancel"].ToString() == "Y")
                    pal.Visible = true;
                else
                    pal.Visible = false;

            }
        }
    }
}